package sn.gandal.mobile.kalpet.activities;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import org.apache.http.client.ClientProtocolException;

import sn.gandal.mobile.kalpet.R;
import sn.gandal.mobile.kalpet.data.DataBridgeAcces;
import sn.gandal.mobile.kalpet.data.entities.DatabaseManager;
import sn.gandal.mobile.kalpet.utils.Json2JavaParser;
import sn.gandal.mobile.kalpet.utils.PropertiesKey;
import sn.gandal.mobile.kalpet.utils.PropertiesUtils;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.res.AssetManager;
import android.content.res.Resources;
import android.content.res.Resources.NotFoundException;
import android.os.Bundle;
import android.os.StrictMode;
import android.widget.TextView;

public class KMainPourTestDev extends Activity {
	
	TextView tx;
	 @SuppressLint("")
	 public void onCreate(Bundle savedInstanceState) {
	 		 
	 		 if (android.os.Build.VERSION.SDK_INT > 9) {
	    	      StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
	    	      StrictMode.setThreadPolicy(policy);
	    	    }
	 		 	DataBridgeAcces.init(this);

	 			super.onCreate(savedInstanceState);
	 			setContentView(R.layout.main_pour_tests);
	 		    showPropertiesData();
	 			
	 }

	private void showPropertiesData(){
		
		tx=(TextView)findViewById(R.id.test);
		String historique=DataBridgeAcces.getServerResourcesManager().getAllHistorics(null, null, null);
		
		String message= "getBoolean ==> "+PropertiesUtils.getBoolean(this, PropertiesKey.DATA_ACCES_MODE_MOCK);
		message+=" getString ==>"+PropertiesUtils.getString(this, PropertiesKey.DATA_ACCES_MODE_MOCK);
		
			//message+="json data"+DataBridgeAcces.getServerResourcesManager().authServer(null, null);
			//message+="taille objet historiques "+historique;
			message+="taille objet historiques "+Json2JavaParser.parseHistorique(historique).size();
		
		tx.setText(message);
		
	}

}
